import 'package:flutter/material.dart';

extension SizeAdapterExtension on num {
  /// 获取一个用于纵向占位的[SizedBox]
  /// * eg. [Column] 的空间占位
  SizedBox get vGap => SizedBox(width: 0, height: toDouble());

  /// 获取一个用于横向占位的sizeBox[SizedBox]
  /// * eg. [Row] 的空间占位
  SizedBox get hGap => SizedBox(width: toDouble(), height: 0);

  /// 获取 相对于 375宽 的大小
  double adapterWidth(BuildContext context) {
    final screenSize = MediaQuery.of(context).size;
    return this * screenSize.width / 375;
    // return this * 430 / 375;
  }
}

extension HexColor on String {
  Color get color => Color(int.parse(toLowerCase().replaceFirst('0x', ''), radix: 16));
}
